<template>
  <div class="detail">
    <h2>这是{{ schoolName }}校区的详情页</h2>
  </div>
</template>

<script>
export default {
  data() {
    return {
      schoolName: "",
    };
  },
  mounted() {
    console.log("-----", this.$route);
    let id = this.$route.params.id;
    this.schoolName =
      id == "1" ? "广州" : id == "2" ? "深圳" : id == "3" ? "江苏" : "不知道";
  },
  watch: {
    $route() {
      let id = this.$route.params.id;
      this.schoolName =
        id == "1" ? "广州" : id == "2" ? "深圳" : id == "3" ? "江苏" : "不知道";
    },
  },
};
</script>

<style lang="less" scoped>
.detail {
  width: 90%;
  background-color: skyblue;
}
</style>
